

#include<stdio.h>
int main() {
	int n;
	scanf_s("%d", &n);
	char value[100][1000];
	int m;
	for (m = 0; m < n; m++) {
		scanf_s("%s", &value[m]);
	}
	int data[1000];
	int top = -1;

	for (m = 0; m < n; m++) {
		int p = 0;
		while (value[m][p] != NULL) {
			if (value[m][p] = '{') { data[p] = value[m][p]; p++; }
			if (value[m][p] = '[') { data[p] = value[m][p]; p++; }
			if (value[m][p] = '(') { data[p] = value[m][p]; p++; }
			if (value[m][p] = '<') { data[p] = value[m][p]; p++; }
			if (value[m][p] = '>') { data[p] = value[m][p]; p++; }
			if (value[m][p] = ')') { data[p] = value[m][p]; p++; }
			if (value[m][p] = ']') { data[p] = value[m][p]; p++; }
			if (value[m][p] = '}') { data[p] = value[m][p]; p++; }
		}
		if (p % 2 != 0) { break; }
		

		}

	return 0;
}
